﻿using System.Text;

namespace Randomletters
{
    internal class Program
    {
        const int time = 10;
        static void Main(string[] args)
        {
            int error = 0;
            double reactiontime = 0;
            Random rnd = new Random();
            for (int i = 0; i < time; i++)
            {
                DateTime starttime = DateTime.Now;
                Console.Clear();
                Console.WriteLine($"现在是第{i}次测试，总耗时{reactiontime}秒，共错误{error}次");
                int num = rnd.Next(0, 52);
                char letters = 'A';
                if (num < 26)
                {
                    letters = (char)(65 + num);
                }
                else
                {
                    letters = (char)(97 + num - 26);
                }
                Console.WriteLine(letters);
                bool flag = false;
                do
                {
                    char input =Console.ReadKey().KeyChar;
                    if (input == letters) flag = true;
                    else error++;
                } while (flag == false);
                DateTime endtime = DateTime.Now;
                reactiontime += (endtime - starttime).TotalSeconds;
            }
            Console.ReadKey();

        }
    }
}